﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Init {
    import flash.events.*;
    import Engine.Init.*;
    import Transactions.*;
    import Classes.util.*;

    public class TransactionsInit extends InitializationAction {

        public static const INIT_ID:String = "TransactionsInit";

        public function TransactionsInit(){
            super(INIT_ID);
            addDependency(GameSettingsInit.INIT_ID);
            addDependency(SocialNetworkInit.INIT_ID);
            addDependency(GlobalsInit.INIT_ID);
            addDependency(ItemImageBundleInit.INIT_ID);
            addDependency(UIInit.INIT_ID);
            addDependency(LocaleFontInit.INIT_ID);
            _weight = 25;
        }
        override public function execute():void{
            var _local1:CompleteMonitor;
            var _local2:TInitUser;
            if (GlobalEngine.socialNetwork){
                _local1 = new CompleteMonitor();
                _local2 = new TInitUser(GlobalEngine.socialNetwork.getLoggedInUser().firstName);
                _local1.addDispatcher(_local2);
                _local1.addEventListener(Event.COMPLETE, this.onTransactionsComplete);
                GameTransactionManager.addTransaction(_local2, true, true);
                GlobalEngine.zaspManager.trackTimingStart("TINIT_USER");
            };
        }
        protected function onTransactionsComplete(_arg1:Event):void{
            dispatchEvent(new Event(Event.COMPLETE));
            GlobalEngine.zaspManager.trackTimingStop("TINIT_USER");
        }

    }
}//package Init 
